using JetBrains.Annotations;
using JetBrains.ReSharper.Feature.Services.Generate;
using JetBrains.ReSharper.Intentions.CSharp.QuickFixes;
using JetBrains.ReSharper.Plugins.Unity.CSharp.Feature.Services.Generate.Dots;
using JetBrains.ReSharper.Plugins.Unity.Resources;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using JetBrains.ReSharper.Psi.Tree;

namespace JetBrains.ReSharper.Plugins.Unity.CSharp.Feature.Services.QuickFixes
{
    public class GenerateRefAccessorsActionFix : WorkflowDrivenImplementMembersFix<GenerateRefFieldsAccessorsWorkflow>
    {
        public GenerateRefAccessorsActionFix(IClassLikeDeclaration typeDeclaration,
            [CanBeNull] ITreeNode anchor) 
            : base(typeDeclaration, anchor)
        {
        }

        public override string Text => Strings.UnityDots_GenerateRefAccessors_Name;

        protected override GenerateRefFieldsAccessorsWorkflow TryCreateWorkflow()
        {
            return new GenerateRefFieldsAccessorsWorkflow();
        }

        protected override void ConfigureContext(IGeneratorContext context)
        {
            // Don't call base. This will add all values into InputEvents which means all items are checked in the list.
            // This is useful for a Quick Fix that is implementing missing members, but we're more of a Context Action.
            // Try and set the anchor for where we want to generate the new members, if we have one
        }
    }
}